package com.example.daojia.frametest.Activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.example.daojia.frametest.R;
import com.example.daojia.frametest.Retrofit.UserHelper;

import org.json.JSONObject;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.reactivex.functions.Consumer;

@Route(path = "/test/retrofit")
public class retrofit extends AppCompatActivity {
    private static final String TAG = retrofit.class.getSimpleName() + "TAG";
    @BindView(R.id.retrofittest)
    Button retrofittest;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_retrofit);
        ButterKnife.bind(this);
    }

    @OnClick(R.id.retrofittest)
    public void login() {
//        UserHelper.login("18810358133", "123456", "", "40.0399500000", "116.4168700000")
//                .subscribe(new Consumer<String>() {
//                    @Override
//                    public void accept(String result) throws Exception {
//                        Log.w(TAG, "loginaccept" + " = " + result);
//                    }
//                }, new Consumer<Throwable>() {
//                    @Override
//                    public void accept(Throwable throwable) throws Exception {
//                        Log.w(TAG, "loginaccept" + " = " + throwable.getStackTrace().toString());
//                    }
//                });

        Log.w(TAG, "loginaccept" + " = " + "running");
        UserHelper.getDriver("1234567")
                .subscribe(new Consumer<String>() {
                    @Override
                    public void accept(String s) throws Exception {
                        Log.w(TAG, "loginaccept" + " = " + s);
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {

                    }
                });
//        String[] str = new String[5];
//        for (int i = 0;i < str.length;i++) {
//            Log.w(TAG, "loginaccept" + " = " + str[i]);
//        }


    }
}
